#ifndef UTILITIES_H_                                                                                                                                /** MSH on A3 **/
#define UTILITIES_H_                                                                                                                                /** MSH on A3 **/

#include <sstream>																																	/** MSH on A3 **/
#include <iostream>																																	/** MSH on A3 **/
#include <iomanip>																																	/** MSH on A2 part II **/
#include "Address.h"                                                                                                                              /** CPO on A1 **/

using namespace std;                                                                                                                                /** MSH on A3 **/

struct Utilities {                                                                                                                                  /** MSH on A3 **/
public:                                                                                                                                             /** MSH on A3 **/
	static const int CAT_ID_LENGTH = 5;																												/** MSH on A2 part II **/
	static const int CAT_NAME_LENGTH = 15;																											/** MSH on A2 part II **/
	static const int CUST_ID_LENGTH = 5;																											/** MSH on A2 part II **/
	static const int CUST_NAME_LENGTH = 30;																											/** MSH on A2 part II **/
	static const int CUST_ADDRESS_LENGTH = 100;																										/** MSH on A2 part II **/
	static const int PRD_ID_LENGTH = 5;																												/** MSH on A2 part II **/
	static const int PRD_CATID_LENGTH = 7;																											/** MSH on A2 part II **/
	static const int PRD_NAME_LENGTH = 50;																											/** MSH on A2 part II **/
	static const int PRD_PRICE_LENGTH = 10;																											/** MSH on A2 part II **/

	static string padLeft (string str, int length) {																								/** MSH on A2 part II **/
		stringstream ss;                                                                                                                            /** MSH on A2 part II **/
		if (length > str.length()) {																												/** MSH on A2 part II **/
			ss << setw(length - str.length()) << "0" << str;																						/** MSH on A2 part II **/
		} else {																																	/** MSH on A2 part II **/
			return (str.substr(0, length));																											/** MSH on A2 part II **/
		}																																			/** MSH on A2 part II **/
	    return (ss.str());                                                                                                                          /** MSH on A2 part II **/
	}																																				/** MSH on A2 part II **/
	static string padRight (string str, int length) {																								/** MSH on A2 part II **/
		stringstream ss;                                                                                                                            /** MSH on A2 part II **/
		if (length > str.length()) {																												/** MSH on A2 part II **/
			ss << str << setw(length - str.length()) << " ";																						/** MSH on A2 part II **/
		} else {																																	/** MSH on A2 part II **/
			return (str.substr(0, length));																											/** MSH on A2 part II **/
		}																																			/** MSH on A2 part II **/
	    return (ss.str());                                                                                                                          /** MSH on A2 part II **/
	}																																				/** MSH on A2 part II **/
	static string convertInt (int i) {                                                                                                              /** MSH on A3 **/
	    stringstream ss;                                                                                                                            /** MSH on A3 **/
	    ss << i;                                                                                                                                    /** MSH on A3 **/
	    return (ss.str());                                                                                                                          /** MSH on A3 **/
	}                                                                                                                                               /** MSH on A3 **/
	static string convertDouble (double d) {                                                                                                        /** MSH on A3 **/
	    stringstream ss;                                                                                                                            /** MSH on A3 **/
	    ss << d;                                                                                                                                    /** MSH on A3 **/
	    return (ss.str());                                                                                                                          /** MSH on A3 **/
	}                                                                                                                                               /** MSH on A3 **/
        static string convertAddress (Street_address a)                                                                                                        /** CPO on A1 **/
        {                                                                                                                                               /** CPO on A1 **/
            stringstream ss;                                                                                                                            /** CPO on A1 **/
            ss<<a.get_building_id()<<" "<<a.get_street_id()<<" "<<a.get_zip_id();                                                                                             /** CPO on A1 **/
            return (ss.str());                                                                                                                          /** CPO on A1 **/
        }                                                                                                                                               /** CPO on A1 **/
};                                                                                                                                                  /** MSH on A3 **/

#endif //UTILITIES_H_                                                                                                                               /** MSH on A3 **/
